/**
 * 数组去重
 */
function removeEque(){
    let arr = [
        {id:1,name:'jack'},
        {id:2,name:'rose'},
        {id:1,name:'tom'},
        {id:3,name:'lilei'},
        {id:1,name:'xiaoming'},
    ]

    let newArr = []
    arr.forEach(item =>{
        let index = newArr.findIndex(i=>i.id == item.id)
        if(index == -1){
            newArr.push(item)
        }else{
            let num = newArr.findIndex(ele=>ele.id == item.id)
            newArr[num] = item
        }
    })

    console.log(newArr);
}

removeEque()